   package com.example.imeiplugin;

   import android.content.Context;
   import android.telephony.TelephonyManager;
   import android.util.Log;

   import com.alibaba.fastjson.JSONObject;

   import io.dcloud.feature.uniapp.annotation.UniJSMethod;
   import io.dcloud.feature.uniapp.bridge.UniJSCallback;
   import io.dcloud.feature.uniapp.common.UniModule;

   public class IMEIPlugin extends UniModule {
       @UniJSMethod(uiThread = true)
       public void getIMEI(UniJSCallback callback) {
           try {
               Context context = mUniSDKInstance.getContext();
               TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
               String imei = telephonyManager.getDeviceId();
               JSONObject result = new JSONObject();
               result.put("imei", imei);
               callback.invoke(result);
           } catch (Exception e) {
               Log.e("IMEIPlugin", "获取 IMEI 失败", e);
               callback.invoke(new JSONObject());
           }
       }
   }